package com.woniuxy.hospital.hplutils;

public class ResponseEntity<T> {
	private int code;//状态码
	private String msg;//可选，描述信息
	private T data;//可选，响应的数据
	public final static ResponseEntity<Void> SUCCESS = new ResponseEntity<Void>(ResponseState.SUCCESS, "ok");
	public final static ResponseEntity<Void> FAIL = new ResponseEntity<Void>(ResponseState.FAIL, "失败");
	public final static ResponseEntity<Void> INVALIDARGS = new ResponseEntity<Void>(ResponseState.INVALIDARGS, "无效参数");
	public final static ResponseEntity<Void> FORBID = new ResponseEntity<Void>(ResponseState.FORBID, "禁止");

	public ResponseEntity() {
	}
	public ResponseEntity(int code , String msg) {
		this.code=code;
		this.msg=msg;
	}
	public ResponseEntity(T data) {
		this(200,"ok");
		this.data = data;
	}

	public int getCode() {
		return code;
	}
	public void setCode(int code) {
		this.code = code;
	}
	public String getMsg() {
		return msg;
	}
	public void setMsg(String msg) {
		this.msg = msg;
	}
	public T getData() {
		return data;
	}
	public void setData(T data) {
		this.data = data;
	}
}
